\hypertarget{class_direct_show_capture}{
\section{DirectShowCapture Class Reference}
\label{class_direct_show_capture}\index{DirectShowCapture@{DirectShowCapture}}
}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_direct_show_capture_a3ac34ee1e27df9abfd2a57ac40be2f06}{
\hyperlink{class_direct_show_capture_a3ac34ee1e27df9abfd2a57ac40be2f06}{DirectShowCapture} ()}
\label{class_direct_show_capture_a3ac34ee1e27df9abfd2a57ac40be2f06}

\begin{DoxyCompactList}\small\item\em Constructor. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a868091c0d5e2806135d7f8ff9b322fa0}{
\hyperlink{class_direct_show_capture_a868091c0d5e2806135d7f8ff9b322fa0}{$\sim$DirectShowCapture} ()}
\label{class_direct_show_capture_a868091c0d5e2806135d7f8ff9b322fa0}

\begin{DoxyCompactList}\small\item\em Destructor. \item\end{DoxyCompactList}\item 
int \hyperlink{class_direct_show_capture_a64c0cdea3fc179a25cbba3929c61b55e}{Start} (const std::string \&videoSource, const int width=0, const int height=0, const bool interlace=false)
\begin{DoxyCompactList}\small\item\em Start capture from a video source. \item\end{DoxyCompactList}\item 
int \hyperlink{class_direct_show_capture_a53cff1e401b0ae4717ed4b208c74a600}{Stop} ()
\begin{DoxyCompactList}\small\item\em Stops capture from video source. \item\end{DoxyCompactList}\item 
int \hyperlink{class_direct_show_capture_a8c25324baa37d7efe2c229f4067f8c20}{GetFrame} (\hyperlink{class_cv_image_capture_1_1_image}{CvImageCapture::Image} $\ast$dest, const bool block=false)
\begin{DoxyCompactList}\small\item\em Get the next frame from the image source. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a39750f03ed78918160ede714814a8bd7}{
bool {\bfseries IsReady} () const }
\label{class_direct_show_capture_a39750f03ed78918160ede714814a8bd7}

\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static unsigned int \hyperlink{class_direct_show_capture_a303b198f72c8f15d7d3dccf6b874f298}{ScanForSources} (std::vector$<$ std::string $>$ \&sources)
\begin{DoxyCompactList}\small\item\em Get a list of video sources connected to the computer (cameras). \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{class_direct_show_capture_abcb19c6d98f421a68a5511060512cf25}{InitializeVideo} ()
\begin{DoxyCompactList}\small\item\em Initializes capture from a video source, (USB or Firewire DV Camera). \item\end{DoxyCompactList}\item 
int \hyperlink{class_direct_show_capture_a70979e31d51e5c1a27aaf1f10b4535e4}{InitializeFile} ()
\begin{DoxyCompactList}\small\item\em Initializes capture from a file video source. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a54118a00dd1b714556f694bd7c275d26}{
{\bfseries STDMETHODIMP\_\-} (ULONG) AddRef()}
\label{class_direct_show_capture_a54118a00dd1b714556f694bd7c275d26}

\item 
\hypertarget{class_direct_show_capture_a08d0f169eb356387e166f48260d711cc}{
{\bfseries STDMETHODIMP\_\-} (ULONG) Release()}
\label{class_direct_show_capture_a08d0f169eb356387e166f48260d711cc}

\item 
\hypertarget{class_direct_show_capture_adcb07713f72c96507c35a754c1009db7}{
STDMETHODIMP \hyperlink{class_direct_show_capture_adcb07713f72c96507c35a754c1009db7}{QueryInterface} (REFIID riid, void $\ast$$\ast$ppv)}
\label{class_direct_show_capture_adcb07713f72c96507c35a754c1009db7}

\begin{DoxyCompactList}\small\item\em This function is part of the callbacks used by ISampleGrabberCB. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a8a95df2fea721ef900dfefcaf280b467}{
virtual HRESULT STDMETHODCALLTYPE \hyperlink{class_direct_show_capture_a8a95df2fea721ef900dfefcaf280b467}{SampleCB} (double sampleTime, IMediaSample $\ast$pSample)}
\label{class_direct_show_capture_a8a95df2fea721ef900dfefcaf280b467}

\begin{DoxyCompactList}\small\item\em This function is part of the callbacks used by ISampleGrabberCB. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a62afa444296990130bce4d1226e98bd5}{
virtual HRESULT STDMETHODCALLTYPE \hyperlink{class_direct_show_capture_a62afa444296990130bce4d1226e98bd5}{BufferCB} (double sampleTime, BYTE $\ast$pBuffer, long bufferLen)}
\label{class_direct_show_capture_a62afa444296990130bce4d1226e98bd5}

\begin{DoxyCompactList}\small\item\em The implemented callback function. Gets latest frame from the video feed. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
static HRESULT \hyperlink{class_direct_show_capture_a3ef69b2f60493475e2e6c6fbe6d5912b}{GetVideoInputFilter} (IBaseFilter $\ast$$\ast$gottaFilter, wchar\_\-t $\ast$matchName)
\begin{DoxyCompactList}\small\item\em Enumerate all of the video input devices. \item\end{DoxyCompactList}\item 
static HRESULT \hyperlink{class_direct_show_capture_a5ca401037c629700f57b88e7573bbd27}{GetVideoInputFilter} (IBaseFilter $\ast$$\ast$gottaFilter, const int num)
\begin{DoxyCompactList}\small\item\em Enumerate all of the video input devices. \item\end{DoxyCompactList}\item 
static HRESULT \hyperlink{class_direct_show_capture_ac84e2ff5d2b964f3240a78dd776d06e2}{GetPin} (IBaseFilter $\ast$pFilter, PIN\_\-DIRECTION dirrequired, int iNum, IPin $\ast$$\ast$ppPin)
\begin{DoxyCompactList}\small\item\em Get a pin in the the graph. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_direct_show_capture_a636509010814455fdbb0907cae0e303c}{
IMediaControl $\ast$ \hyperlink{class_direct_show_capture_a636509010814455fdbb0907cae0e303c}{pControl}}
\label{class_direct_show_capture_a636509010814455fdbb0907cae0e303c}

\begin{DoxyCompactList}\small\item\em Used by direct show for media \hyperlink{structcontrol}{control}. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a88f616dc989ef687ab6c5c2f7fe8770a}{
ISampleGrabber $\ast$ \hyperlink{class_direct_show_capture_a88f616dc989ef687ab6c5c2f7fe8770a}{pGrabber}}
\label{class_direct_show_capture_a88f616dc989ef687ab6c5c2f7fe8770a}

\begin{DoxyCompactList}\small\item\em Used to grab frames. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a225014b0bbc80005fed0bb8b062397f3}{
HANDLE \hyperlink{class_direct_show_capture_a225014b0bbc80005fed0bb8b062397f3}{mImageMutex}}
\label{class_direct_show_capture_a225014b0bbc80005fed0bb8b062397f3}

\begin{DoxyCompactList}\small\item\em Mutex for thread protection. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a062824abd1e7c5a29478cdf02d3a560e}{
volatile bool \hyperlink{class_direct_show_capture_a062824abd1e7c5a29478cdf02d3a560e}{mStopFlag}}
\label{class_direct_show_capture_a062824abd1e7c5a29478cdf02d3a560e}

\begin{DoxyCompactList}\small\item\em Flag to stop video capture. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_aaaafca11e20b579443ee03a1cf8efdee}{
volatile bool \hyperlink{class_direct_show_capture_aaaafca11e20b579443ee03a1cf8efdee}{mReadyFlag}}
\label{class_direct_show_capture_aaaafca11e20b579443ee03a1cf8efdee}

\begin{DoxyCompactList}\small\item\em Flag to signal capture is ready. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a9894a1c4eff5176fe13d3875960f2a01}{
volatile bool \hyperlink{class_direct_show_capture_a9894a1c4eff5176fe13d3875960f2a01}{mInterlacedFlag}}
\label{class_direct_show_capture_a9894a1c4eff5176fe13d3875960f2a01}

\begin{DoxyCompactList}\small\item\em Should we de-\/interlace the frame? \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a4d54555b478b0cbc92b3518162ffcbc8}{
volatile unsigned int \hyperlink{class_direct_show_capture_a4d54555b478b0cbc92b3518162ffcbc8}{mFrameNumber}}
\label{class_direct_show_capture_a4d54555b478b0cbc92b3518162ffcbc8}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_frame}{Frame} number. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a0d20e94fc50aa95838880ebf3e44f017}{
long \hyperlink{class_direct_show_capture_a0d20e94fc50aa95838880ebf3e44f017}{mDataSize}}
\label{class_direct_show_capture_a0d20e94fc50aa95838880ebf3e44f017}

\begin{DoxyCompactList}\small\item\em Size of image buffer in bytes. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a767c213e4d9fa0663abca45d1e51fbe9}{
int \hyperlink{class_direct_show_capture_a767c213e4d9fa0663abca45d1e51fbe9}{mWidth}}
\label{class_direct_show_capture_a767c213e4d9fa0663abca45d1e51fbe9}

\begin{DoxyCompactList}\small\item\em Width of the image in pixels. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a1126c34433ebb2efeec8fed320265dd4}{
int \hyperlink{class_direct_show_capture_a1126c34433ebb2efeec8fed320265dd4}{mHeight}}
\label{class_direct_show_capture_a1126c34433ebb2efeec8fed320265dd4}

\begin{DoxyCompactList}\small\item\em Height of the image in pixels. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a6a0751b0c9cc0bba5fc0b318fd5bd746}{
int \hyperlink{class_direct_show_capture_a6a0751b0c9cc0bba5fc0b318fd5bd746}{mDesWidth}}
\label{class_direct_show_capture_a6a0751b0c9cc0bba5fc0b318fd5bd746}

\begin{DoxyCompactList}\small\item\em Desired width. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a6992bf1910c973940b6d64eae77b5a2c}{
int \hyperlink{class_direct_show_capture_a6992bf1910c973940b6d64eae77b5a2c}{mDesHeight}}
\label{class_direct_show_capture_a6992bf1910c973940b6d64eae77b5a2c}

\begin{DoxyCompactList}\small\item\em Desired height. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_afd23608585277c7331eb6b354cc857ea}{
unsigned char $\ast$ \hyperlink{class_direct_show_capture_afd23608585277c7331eb6b354cc857ea}{mpImageBuffer}}
\label{class_direct_show_capture_afd23608585277c7331eb6b354cc857ea}

\begin{DoxyCompactList}\small\item\em Actual image data. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_abb592e5fec12d09836e939ea67754988}{
unsigned int \hyperlink{class_direct_show_capture_abb592e5fec12d09836e939ea67754988}{mGetFrameNumber}}
\label{class_direct_show_capture_abb592e5fec12d09836e939ea67754988}

\begin{DoxyCompactList}\small\item\em The last frame number retrieved. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a4972b6e266a606d204aa8ead94611c35}{
double \hyperlink{class_direct_show_capture_a4972b6e266a606d204aa8ead94611c35}{mFrameTimeMs}}
\label{class_direct_show_capture_a4972b6e266a606d204aa8ead94611c35}

\begin{DoxyCompactList}\small\item\em Time of frame capture. \item\end{DoxyCompactList}\item 
\hypertarget{class_direct_show_capture_a443b759fd89d5be46d3ed69526791055}{
std::string \hyperlink{class_direct_show_capture_a443b759fd89d5be46d3ed69526791055}{mSourceName}}
\label{class_direct_show_capture_a443b759fd89d5be46d3ed69526791055}

\begin{DoxyCompactList}\small\item\em Name of image source. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Member Function Documentation}
\hypertarget{class_direct_show_capture_a8c25324baa37d7efe2c229f4067f8c20}{
\index{DirectShowCapture@{DirectShowCapture}!GetFrame@{GetFrame}}
\index{GetFrame@{GetFrame}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{GetFrame}]{\setlength{\rightskip}{0pt plus 5cm}int DirectShowCapture::GetFrame ({\bf CvImageCapture::Image} $\ast$ {\em dest}, \/  const bool {\em block} = {\ttfamily false})}}
\label{class_direct_show_capture_a8c25324baa37d7efe2c229f4067f8c20}


Get the next frame from the image source. An internal counter is kept that keeps track of what frame number was last retrieved from the image source. This counter prevents you from get the same frame multiple times (over sampling). If you set the blocking flag to false, then if the next frame hasn't arrived yet, the function will return 0.


\begin{DoxyParams}{Parameters}
\item[{\em dest}]The destination (where to save image to). \item[{\em block}]If true, then this function will block until the next image arrives, otherwise not.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if image retrieved, otherwise 0. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_ac84e2ff5d2b964f3240a78dd776d06e2}{
\index{DirectShowCapture@{DirectShowCapture}!GetPin@{GetPin}}
\index{GetPin@{GetPin}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{GetPin}]{\setlength{\rightskip}{0pt plus 5cm}HRESULT DirectShowCapture::GetPin (IBaseFilter $\ast$ {\em pFilter}, \/  PIN\_\-DIRECTION {\em dirrequired}, \/  int {\em iNum}, \/  IPin $\ast$$\ast$ {\em ppPin})\hspace{0.3cm}{\ttfamily  \mbox{[}static, protected\mbox{]}}}}
\label{class_direct_show_capture_ac84e2ff5d2b964f3240a78dd776d06e2}


Get a pin in the the graph. 
\begin{DoxyParams}{Parameters}
\item[{\em pFilter}]The filter. \item[{\em dirrequired}]The pin directoin required. \item[{\em iNum}]Input number. \item[{\em ppPin}]Pointer to pin.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Result $<$ 0 is failure, $>$= 0 is success. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a5ca401037c629700f57b88e7573bbd27}{
\index{DirectShowCapture@{DirectShowCapture}!GetVideoInputFilter@{GetVideoInputFilter}}
\index{GetVideoInputFilter@{GetVideoInputFilter}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{GetVideoInputFilter}]{\setlength{\rightskip}{0pt plus 5cm}HRESULT DirectShowCapture::GetVideoInputFilter (IBaseFilter $\ast$$\ast$ {\em gottaFilter}, \/  const int {\em num})\hspace{0.3cm}{\ttfamily  \mbox{[}static, protected\mbox{]}}}}
\label{class_direct_show_capture_a5ca401037c629700f57b88e7573bbd27}


Enumerate all of the video input devices. 
\begin{DoxyParams}{Parameters}
\item[{\em gottaFilter}]Input filter pointer. \item[{\em num}]The video device number to get input filter for. This is \mbox{[}0, num video sources\mbox{]}.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The filter with a matching friendly name. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a3ef69b2f60493475e2e6c6fbe6d5912b}{
\index{DirectShowCapture@{DirectShowCapture}!GetVideoInputFilter@{GetVideoInputFilter}}
\index{GetVideoInputFilter@{GetVideoInputFilter}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{GetVideoInputFilter}]{\setlength{\rightskip}{0pt plus 5cm}HRESULT DirectShowCapture::GetVideoInputFilter (IBaseFilter $\ast$$\ast$ {\em gottaFilter}, \/  wchar\_\-t $\ast$ {\em matchName})\hspace{0.3cm}{\ttfamily  \mbox{[}static, protected\mbox{]}}}}
\label{class_direct_show_capture_a3ef69b2f60493475e2e6c6fbe6d5912b}


Enumerate all of the video input devices. 
\begin{DoxyParams}{Parameters}
\item[{\em gottaFilter}]Input filter pointer. \item[{\em matchName}]The friendly name of the device (camera name) to match to.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The filter with a matching friendly name. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a70979e31d51e5c1a27aaf1f10b4535e4}{
\index{DirectShowCapture@{DirectShowCapture}!InitializeFile@{InitializeFile}}
\index{InitializeFile@{InitializeFile}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{InitializeFile}]{\setlength{\rightskip}{0pt plus 5cm}int DirectShowCapture::InitializeFile ()\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_direct_show_capture_a70979e31d51e5c1a27aaf1f10b4535e4}


Initializes capture from a file video source. \begin{DoxyReturn}{Returns}
1 if success, otherwise 0. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_abcb19c6d98f421a68a5511060512cf25}{
\index{DirectShowCapture@{DirectShowCapture}!InitializeVideo@{InitializeVideo}}
\index{InitializeVideo@{InitializeVideo}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{InitializeVideo}]{\setlength{\rightskip}{0pt plus 5cm}int DirectShowCapture::InitializeVideo ()\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_direct_show_capture_abcb19c6d98f421a68a5511060512cf25}


Initializes capture from a video source, (USB or Firewire DV Camera). \begin{DoxyReturn}{Returns}
1 if success, otherwise 0. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a303b198f72c8f15d7d3dccf6b874f298}{
\index{DirectShowCapture@{DirectShowCapture}!ScanForSources@{ScanForSources}}
\index{ScanForSources@{ScanForSources}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{ScanForSources}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int DirectShowCapture::ScanForSources (std::vector$<$ std::string $>$ \& {\em sources})\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{class_direct_show_capture_a303b198f72c8f15d7d3dccf6b874f298}


Get a list of video sources connected to the computer (cameras). 
\begin{DoxyParams}{Parameters}
\item[{\em sources}]Copy of source names.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The number of video sources connected to the computer. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a64c0cdea3fc179a25cbba3929c61b55e}{
\index{DirectShowCapture@{DirectShowCapture}!Start@{Start}}
\index{Start@{Start}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{Start}]{\setlength{\rightskip}{0pt plus 5cm}int DirectShowCapture::Start (const std::string \& {\em videoSource}, \/  const int {\em width} = {\ttfamily 0}, \/  const int {\em height} = {\ttfamily 0}, \/  const bool {\em interlace} = {\ttfamily false})}}
\label{class_direct_show_capture_a64c0cdea3fc179a25cbba3929c61b55e}


Start capture from a video source. If width or height $<$= 0 the largest formats upported from the video source is used. Otherwise an attempt to select the size will be tried, and if the desired resolution fails, a default resolution will be used. This \hyperlink{structfeature}{feature} may not be supported outside of Windows and does not work with video files (only cameras).


\begin{DoxyParams}{Parameters}
\item[{\em videoSource}]The String/Friendly name of the video source. If left blank ( \char`\"{}\char`\"{} ), then the first device on the system will be used. This value is the name of a camera or a video file. You can also use an ascii number representing the device. For example \char`\"{}0\char`\"{} for camera 0, \char`\"{}1\char`\"{} for camera 1, etc. \item[{\em width}]Desired image width resolution if supported. If $<$= 0 then first working resolution is chosen from camera. \item[{\em height}]Desired image height resolutoin if supported. If $<$= 0 then first working resolution is chosen from camera. \item[{\em iterlace}]If the video is interlaced, set to true and it will be automatically de-\/interlaced.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if started, otherwise 0. 
\end{DoxyReturn}
\hypertarget{class_direct_show_capture_a53cff1e401b0ae4717ed4b208c74a600}{
\index{DirectShowCapture@{DirectShowCapture}!Stop@{Stop}}
\index{Stop@{Stop}!DirectShowCapture@{DirectShowCapture}}
\subsubsection[{Stop}]{\setlength{\rightskip}{0pt plus 5cm}int DirectShowCapture::Stop ()}}
\label{class_direct_show_capture_a53cff1e401b0ae4717ed4b208c74a600}


Stops capture from video source. \begin{DoxyReturn}{Returns}
1 if stopped, otherwise 0. 
\end{DoxyReturn}


The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
C:/Users/Matt/Documents/School/Robotics/zebulon/v2/cv/src/cv/cvimagecapturewindows.cpp\end{DoxyCompactItemize}
